package com.feihua.starter.comm;

/**
 * @Auther: wzn
 * @Date: 2018/8/10 09:14
 * @Description:
 */
public class Constants {

    /**
     * 活动审核（未审核，1，审核成功，2，审核失败，3）
     */
    public enum ActivityReview {
        NONE("1", "未审核"),
        SUCCESS("2", "审核成功"),
        FAIL("3", "审核失败");

        private String code;
        private String name;

        ActivityReview(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static ActivityReview getEnumBy(String key) {
            for (ActivityReview e : ActivityReview.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * 活动状态（未开始，0，报名中，1，名额满，2，进行中，3，已结束，4）
     */
    public enum ActivityStatus {
        NOT_START("0", "未开始"),
        APPLYING("1", "报名中"),
        QUOTA_FULL("2", "名额满"),
        STARTING("3", "进行中"),
        END("4", "已结束");

        private String code;
        private String name;

        ActivityStatus(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static ActivityStatus getEnumBy(String key) {
            for (ActivityStatus e : ActivityStatus.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * 活动类型（1，个人，2，组队）
     */
    public enum ActivityType {
        SELF("1", "个人"),
        TEAM("2", "组队");

        private String code;
        private String name;

        ActivityType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static ActivityType getEnumBy(String key) {
            for (ActivityType e : ActivityType.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * 用户类型（0，领队，1，副领队，2，普通用户）
     */
    public enum UserType {
        CAPTAIN("0", "领队"),
        VICE_CAPTAIN("1", "副领队"),
        USER("2", "普通用户");

        private String code;
        private String name;

        UserType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static UserType getEnumBy(String key) {
            for (UserType e : UserType.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * 用户类型（1，普通用户，2管理员（可审核活动（自己的不能审）），3超级管理员可审核全部活动））
     */
    public enum AuthUserType {
        USER("1", "普通用户"),
        MANAGER("2", "管理员"),
        SUPER_MANAGER("3", "超级管理员");

        private String code;
        private String name;

        AuthUserType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static AuthUserType getEnumBy(String key) {
            for (AuthUserType e : AuthUserType.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }

    /**
     * 消息来源
     */
    public enum MsgSource {
        MSG_ACTIVITY("msg_activity", "活动消息"),
        MSG_ALL("msg_all", "群发消息"),
        MSG_SYSTEM("msg_system", "系统消息"),
        MSG_REVIEW("msg_review", "审核消息");
        private String code;
        private String name;

        MsgSource(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static MsgSource getEnumBy(String key) {
            for (MsgSource e : MsgSource.values()) {
                if (e.getCode().equals(key) || e.getName().equals(key)) {
                    return e;
                }
            }
            return null;
        }
    }
}
